<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>includeContentLoaded</title>
    <link rel="stylesheet" href="../lib/bootstrap3/css/bootstrap.min.css">
    <link rel="stylesheet" href="../lib/bootstrap3/css/dashboard.css">
    <script src="../lib/jquery/jquery-1.10.2.js"></script>
    <script src="../lib/angularjs/angular.js"></script>
    <style>body{margin:10px 80px;}</style>
</head>
<body ng-app="app01">
<div class="panel panel-primary"  ng-controller="ctrl01">
    <div class="panel-heading"><b>includeContentLoaded</b></div>
    <div class="panel-body">
        <div ng-include="'first.html'"></div>
        <ng-include src="'first.html'"></ng-include>
        <div id="output" class="bg-danger"></div>
        <div id="output2" class="bg-success"></div>
    </div>
    <div class="panel-footer">
        $includeContentLoaded事件当ngInclude的内容重新加载时，从ngInclude指令上触发。
    </div>
</div>
<script type="text/ng-template" id="first.html">
    <p>This is the 1st nested template</p>
</script>
</body>
<script>
    var app=angular.module('app01',[]);
</script>
<script>
    app.controller('ctrl01',['$rootScope','$scope', "$q", function ($rootScope,$scope, $q) {
        $rootScope.$on('$includeContentLoaded', function(event,uri) {
            $('#output').append('<p>' + event.targetScope.name + ' include\'s content was loaded.<b>URL:'+uri+'</b>'+new Date().toLocaleTimeString()+'-->'+new Date().getTime()+'</p>');
        });
        $rootScope.$on('$includeContentRequested',function (event,uri) {
            $('#output2').append('<p>includeContentRequested:'+new Date().toLocaleTimeString()+new Date().getTime()+'</p>');
        })
    }]);
</script>
</html>